
import { Component } from "cc";
import { NodeKeyBoardProcessor } from "./NodeKeyBoardProcessor";

/**
 * 将此组件挂到节点才可以使用。
 */
export class KeyBoardComponent extends Component {

    protected onLoad(): void {
        let comp = this.node.getComponent(NodeKeyBoardProcessor)
        if (!comp) {
            comp = this.node.addComponent(NodeKeyBoardProcessor)
        }
    }

    get keyProcessor(): NodeKeyBoardProcessor {
        let comp = this.node.getComponent(NodeKeyBoardProcessor)
        if (!comp) {
            comp = this.node.addComponent(NodeKeyBoardProcessor)
        }
        return comp;
    }
}